package com.gbq.utils;

import com.gbq.constants.BaseConstants;
import com.gbq.service.BaseService;
import com.gbq.vo.RequestPerson;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class BaseUtils {

//
//    public static Person RequestPerson2Person(RequestPerson obj){
//        BaseConstants constants = new BaseConstants();
//        Map<String,String> map = constants.getMap();
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        Date date = new Date();
//        try {
//             date = simpleDateFormat.parse(obj.getPassTime());
//        } catch (ParseException e) {
//            e.printStackTrace();
//        }
//
//        Person  person = new Person();
//        person.setName(obj.getName());
//        person.setSex(map.get(obj.getGenderCode()));
//        person.setNation(map.get(obj.getNationCode()));
//        person.setBirthday(obj.getBirthday());
//        person.setCardno(obj.getCardNo());
//        person.setAddress(obj.getAddr());
//        person.setIssueDepartment(obj.getIssuingUnit());
//        person.setTerm(obj.getCardStartTime()+"-"+obj.getCardEndTime());
//        person.setPhotoUrl(obj.getCardImgPath());
//        person.setCollectTime(date);
////        person.setId(id+1);
//
//        return person;
//    }
//
//
//    public static FaceCompare RequestPerson2FaceCompare(RequestPerson obj,Integer deviceId,Integer id){
//        BaseConstants constants = new BaseConstants();
//        Map<String,String> verifyResultMap = constants.getVerifyResultMap();
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        Date date = new Date();
//        try {
//            date = simpleDateFormat.parse(obj.getPassTime());
//        } catch (ParseException e) {
//            e.printStackTrace();
//        }
//
//        FaceCompare faceCompare = new FaceCompare();
//        faceCompare.setPersonId(id);
//        faceCompare.setCollectionPhotoUrl(obj.getFaceImgPath());
//        faceCompare.setSimilarity("80");
//        faceCompare.setCompareResult(verifyResultMap.get(obj.getVerifyResult()));
//        faceCompare.setCompareTime(date);
//        faceCompare.setDeviceId(deviceId);
//
//        return faceCompare;
//    }

//判断字符串包含
    public static Boolean strIndexOf(String completeStr,String partOfStr ){

        if (completeStr.indexOf(partOfStr)!=-1){
            return true;   //包含
        }else {
            return false;  //不包含
        }

    }
}
